<?php

    ini_set("display_errors", 1);

    define("CSS_VERSION", "1.5");
    define("JS_VERSION", "1.5");

    define("RESOURCE_CACHE_ENABLE", false);

    define('INCLUDES_DIR',              str_replace('\\', '/', dirname(__FILE__).'/'));
    define('CLASSES_DIR',               INCLUDES_DIR . 'classes/');

    define('USE_EACCELERATOR_CACHE',    FALSE);

    define("CONFIG_FILE",               "data/config.xml");
    define("REDIRECTS_FILE",            "data/redirects.xml");
    define("QUICK_LINKS_FILE",          "data/quick_links.xml");
    define("PAGES_FILE",                "data/pages.xml");
    define("PAGE_TREE_FILE",            "data/page_tree.xml");
    define("SIDEBARS_FILE",             "data/sidebars.xml");
    define("THEMES_FILE",               "data/themes.xml");

    define("SUPPORT_COM_BOX",           "support@codedrive.com");
    define("RSS_LINK",                  "http://blog.codedrive.com/?feed=rss2");
    define("RSS_TITLE",                 "CodeDrive Blog");

    define("CACHE_DIR",                 "cache/");
    define("BLOG_LINKS_CACHE_PATH",     CACHE_DIR . "blog_links.cache");

    define("CAPTCHA_TMP",               "captcha/_tmp/");
    define("CAPTCHA_TTF",               "../captcha/ttf/");

    define("CACHE",                     '');

    define("RIO_PAGE_ID", "Rio");

    define('NEWS_BLOG_URL',             'http://blog.ispringsolutions.com');
    define('NEWS_BLOG_RSS_URL',         NEWS_BLOG_URL . '/?feed=rss2');
    define('NEWS_UPDATE_PERIOD',        12*60*60); // 12 hours

    define("LNG_PAGES_FILE_PATTERN",       "data/lng/%LNG%/pages.xml");
    define("LNG_SIDEBARS_FILE_PATTERN",    "data/lng/%LNG%/sidebars.xml");
    define("LNG_QUICK_LINKS_FILE_PATTERN", "data/lng/%LNG%/quick_links.xml");

    define("DEFAULT_THEME_ID", "DefaultTheme");

    $host = $_SERVER["SERVER_NAME"];
    $port = $_SERVER["SERVER_PORT"];
    $port = $port == '80' || $port == '8080' ? '' : ":$port";
    $protocol = "http";

    $rootUrl = "{$protocol}://{$host}/";

    $rootPath = dirname(__FILE__). '/../';
    $rootPath = str_replace('\\', '/', $rootPath);
    $rootPath = preg_replace('|/[^/]+?/\.\./|', '/', $rootPath);

    define("ROOT_PATH",         $rootPath);
    define("ROOT_URL",          $rootUrl);

    define("SITE_URL",          $rootUrl);
    define('SITE_LOCAL_PATH',   str_replace('\\', '/', $rootPath));
    define("PATH_TEMPLATES",    SITE_LOCAL_PATH . "content/templates/");
    define('LNG_DIR',           SITE_LOCAL_PATH . 'content/lng/');

    define('FAQ_XML_TEMPLATE',  "data/faq.xml");
    define("PRICE_FORMAT_FILE", ROOT_PATH. "data/price_format.xml");
    define("VISITOR_COOKIE_NAME", "isvisitor");
    define("VISITOR_UID_COOKIE_INDEX",  0);

    define("NGINX_CACHED_PAGE_ACTUAL_FOR",  "2 hours");

    define('ADMIN_USERNAME', 'admin');
    define('ADMIN_PASSWORD', '378762f4d4f45889e69946934cf8eba1697ec76b');

    define("APP_LOG_FILE",              ROOT_PATH . 'logs/application_' . gmdate('Ymd', time()) . '.log');

    unset( $host, $port, $product, $rootPath, $rootUrl );

    define("SESSION_FILES_PATH", '/var/php_sessions/codedrive');
    define("STORE_NAME", "codedrive.com");